#ifndef __GE_RESOURCEMANAGER_H__
#define __GE_RESOURCEMANAGER_H__
#include "GE_Base.h"
namespace Syp
{
///ResourceManager is responsible for the management and garbage collection of all Resources. Any class which derives from Resource will be managed by the ResourceManager.
///Warning: ResourceManager will delete Resources automatically when they are no longer in use, therefore only dynamically allocated Resources should be added.
class SYPAPI ResourceManager : public UniqueRegistry<Resource>
{
	friend class Resource;
public:
	static void initialise();
	static ResourceManager& getResourceManager();
	static void release();
	///Starts cleaning up unused Resources. An unused Resource is one which is not being used by any MeshInstance. This method could take a long time if there are many Resources which require to be deleted.
	void cleanUp();
	Resource* isResourceLoaded(const String& filename);
	void dumpResourceInfo();
	virtual void dumpInfo();
private:
	///Does incremental cleaning every frame
	void cleanSome();
	ResourceManager();
	~ResourceManager();
	static ResourceManager* rm;
	void addResource(Resource* r);
	//void removeResource(Resource* r);
};

}
#endif //__GE_RESOURCEMANAGER_H__

